﻿using System.Linq;

namespace Jet.Dal
{
	/// <summary>
	/// Generic repository which allows to work with entities
	/// </summary>
	/// <typeparam name="TKey">Type of key of the enjtities</typeparam>
	/// <typeparam name="TEntity">Type of the entities</typeparam>
	public interface IRepository<TKey, TEntity> where TEntity : class where TKey : class
	{
		/// <summary>
		/// Returns query to load data.
		/// </summary>
		IQueryable<TEntity> GetQuery();

		/// <summary>
		/// Return change tracking or throws NotImplementedException depending on realization
		/// </summary>
		IChangeTracking<TKey, TEntity> ChangeTracking { get; }

		/// <summary>
		/// returns object which implements crud operations
		/// </summary>
		ICrudRepository<TEntity> CrudOperations { get; }

		/// <summary>
		/// returns object which can create entities
		/// </summary>
		IEntityFactory<TKey, TEntity> EntityFactory { get; }

		/// <summary>
		/// Returns object which allows navigations functionality
		/// </summary>
		INavigable<TEntity> Navigations { get; }
	}
}
